package com.lzycug.singleton;

/**
 * 使用枚举内部类实现单例
 */
public class Singleton8 {
    private Singleton8() {
    }

    private enum SingletonHolder {
        INSTANCE;

        private Singleton8 instance;

        SingletonHolder() {
            this.instance = new Singleton8();
        }

        private Singleton8 getInstance() {
            return instance;
        }
    }

    public static Singleton8 getInstance() {
        return SingletonHolder.INSTANCE.getInstance();
    }
}